<template>
	<view class="page">
		
		<view class="search-block">
			<view class="search-ico-wapper">
				<image src="../../static/icos/search.png" class="search-ico"></image>
			</view>
			<input 
			placeholder="搜索影片"
			maxlength="10"
			class="search-text"
			confirm-type="search"
			@confirm="searchMe"
			/>
		</view>
		
		<view class="movie-list page-block" >
			<view class="movie-wapper" v-for="trailer in trailerList">
				<image 
				:src="trailer.poster" 
				class="poster"
				
				>
				</image>
				
			</view>
			
			
			
		</view>
		
		
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				trailerList: [],
				keywords: "",			// 搜索的关键字
				page: 1,				// 当前第几页
				totalPages: 1	
			}
		},
		
		onLoad() {
			var me = this;
			
			var serverUrl = me.serverUrl;
			
			
			uni.request({
				url: serverUrl + '/search/list?keywords=&page=1&pageSize=9',
				method: 'POST',
				success: (res) => {
					// debugger;
						if (res.data.status == 200) {
							var trailerList = res.data.data;
							me.trailerList = trailerList;
							// console.log(trailerList);
						}
					
				},
				fail: () => {},
				complete: () => {}
			});
		},
		
		methods: {
			searchMe(e) {
				var me = this;
				//获取搜索内容
				var value = e.detail.value;
				me.keywords = value;
				me.trailerList = [];
				
				
				
				
				
			}
		}
	}
</script>

<style>
	@import url("search.css");
</style>
